package top.vains.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.page.PageMethod;
import org.springframework.stereotype.Service;
import top.vains.entity.Role;
import top.vains.entity.customer.Pagination;
import top.vains.mapper.RoleMapper;
import top.vains.service.IRoleService;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author vains
 * @since 2020-02-17
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {

    @Override
    public void getRoles(Pagination pagination) {
        Page<Object> page = PageMethod.startPage(pagination.getCurrent(), pagination.getSize());
        List<Role> roles = baseMapper.selectList(null);
        pagination.setData(roles);
        pagination.setTotal(page.getTotal());
    }
}
